package com.example.demo.mapper;

import com.example.demo.entity.ImgMessage;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public   interface ImgMapper {
    @Insert("insert into imgmessage (imgid,url,createtime,name)values(#{imgid},#{url},#{createtime},#{name})")
    void insertImg(String imgid, String url, String createtime,String name);

    @Select("select url from imgmessage where id=#{id}")
    public   String resolves(String id);

    @Select("select * from imgmessage ORDER BY id DESC ")
    public List<ImgMessage> returnImg();

    @Update("update  imgmessage set count=#{count} where id=#{id}")
    public void updata(int id,int count);

    @Select("select * from imgmessage where imgid=#{imgid}")
    public List<ImgMessage> getuserimgid(String imgid);

    @Select("SELECT * FROM imgmessage order by `count` desc limit 3")
    public List<ImgMessage> getqian3();

    @Select("SELECT * FROM imgmessage order by `count` desc ")
    public List<ImgMessage> getqb();

    @Delete("delete  FROM imgmessage where id=#{id} ")
    public void sc_video(String id);


    @Update("update imgmessage set name=#{name} where imgid=#{imgid}")
    public void upshuju(String name,int imgid);

    @Select("select * from imgmessage  where id >= (select id from imgmessage order by id limit #{i} , 1)  ORDER BY id DESC  limit #{pagesize}")
    public List<ImgMessage> getpicfenye(int i,int  pagesize);
}
